VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmBOL 
   BackColor       =   &H00FFFFFF&
   Caption         =   "FedEx Freight Bill-of-Lading Information"
   ClientHeight    =   7575
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   11160
   Icon            =   "frmBOL.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   7575
   ScaleWidth      =   11160
   StartUpPosition =   1  'CenterOwner
   Begin VB.ComboBox cboItemID 
      Height          =   315
      Left            =   1800
      TabIndex        =   12
      Top             =   3480
      Width           =   2175
   End
   Begin VB.TextBox f6102 
      Height          =   315
      Left            =   6780
      TabIndex        =   8
      Top             =   1200
      Width           =   1095
   End
   Begin VB.CheckBox f1331 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Haz-Mat"
      Height          =   195
      Left            =   5040
      TabIndex        =   20
      Top             =   3540
      Width           =   915
   End
   Begin VB.TextBox f1 
      Height          =   315
      Left            =   1800
      TabIndex        =   0
      Top             =   480
      Width           =   2415
   End
   Begin VB.TextBox f3056 
      Height          =   315
      Left            =   7320
      TabIndex        =   24
      Top             =   4200
      Width           =   3375
   End
   Begin VB.TextBox f1670 
      Height          =   315
      Left            =   1800
      TabIndex        =   15
      Top             =   4560
      Width           =   735
   End
   Begin VB.TextBox f79 
      Height          =   675
      Left            =   7320
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   23
      Top             =   3480
      Width           =   3375
   End
   Begin VB.TextBox f57 
      Height          =   315
      Left            =   3000
      TabIndex        =   18
      Top             =   4920
      Width           =   375
   End
   Begin VB.TextBox f58 
      Height          =   315
      Left            =   2400
      TabIndex        =   17
      Top             =   4920
      Width           =   375
   End
   Begin VB.TextBox f59 
      Height          =   315
      Left            =   1800
      TabIndex        =   16
      Top             =   4920
      Width           =   375
   End
   Begin VB.ComboBox cboBoxName 
      Height          =   315
      Left            =   3540
      TabIndex        =   19
      Top             =   4920
      Width           =   1335
   End
   Begin VB.CommandButton cmdDelete 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "&Delete All"
      Height          =   315
      Left            =   4920
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   29
      Top             =   7140
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.CommandButton cmdClose 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "OK"
      Height          =   315
      Left            =   6720
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   30
      Top             =   7140
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.CommandButton cmdSave 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "&Save/Exit"
      Height          =   315
      Left            =   3120
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   28
      Top             =   7140
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.CommandButton cmdAdd 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "&Add To Shipment"
      Height          =   315
      Left            =   8520
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   27
      Top             =   4920
      UseMaskColor    =   -1  'True
      Width           =   1455
   End
   Begin VB.TextBox f6109 
      Height          =   315
      Left            =   1800
      TabIndex        =   4
      Top             =   1920
      Width           =   2295
   End
   Begin VB.TextBox f6108 
      Height          =   315
      Left            =   1800
      TabIndex        =   3
      Top             =   1560
      Width           =   2295
   End
   Begin VB.TextBox f4683 
      Height          =   315
      Left            =   7320
      TabIndex        =   25
      Top             =   4560
      Width           =   2655
   End
   Begin VB.ComboBox f6107 
      Height          =   315
      ItemData        =   "frmBOL.frx":030A
      Left            =   1800
      List            =   "frmBOL.frx":0317
      TabIndex        =   2
      Top             =   1200
      Width           =   2295
   End
   Begin VB.TextBox f1222 
      Height          =   315
      Left            =   1800
      TabIndex        =   1
      Top             =   840
      Width           =   1095
   End
   Begin VB.TextBox f6101 
      Height          =   315
      Left            =   7320
      TabIndex        =   26
      Top             =   4920
      Width           =   1095
   End
   Begin VB.TextBox f6106 
      Height          =   315
      Left            =   1800
      TabIndex        =   14
      Top             =   4200
      Width           =   1095
   End
   Begin VB.ComboBox f6105 
      Height          =   315
      ItemData        =   "frmBOL.frx":0355
      Left            =   1800
      List            =   "frmBOL.frx":0357
      TabIndex        =   13
      Top             =   3840
      Width           =   1095
   End
   Begin VB.TextBox f1271 
      Height          =   315
      Left            =   5040
      TabIndex        =   22
      Top             =   4200
      Width           =   735
   End
   Begin VB.TextBox f2931 
      Height          =   315
      Left            =   5040
      TabIndex        =   21
      Top             =   3840
      Width           =   735
   End
   Begin VB.ComboBox f4649 
      Height          =   315
      Left            =   6780
      TabIndex        =   10
      Top             =   1920
      Width           =   2295
   End
   Begin VB.TextBox f4648 
      Height          =   315
      Left            =   9660
      TabIndex        =   11
      Top             =   1920
      Width           =   1035
   End
   Begin VB.TextBox f4647 
      Height          =   315
      Left            =   6780
      TabIndex        =   6
      Top             =   480
      Width           =   3915
   End
   Begin VB.TextBox f4639 
      Height          =   315
      Left            =   6780
      TabIndex        =   7
      Top             =   840
      Width           =   3915
   End
   Begin VB.TextBox f4641 
      Height          =   315
      Left            =   6780
      TabIndex        =   9
      Top             =   1560
      Width           =   3915
   End
   Begin VB.TextBox f3021 
      Height          =   495
      Left            =   1800
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   5
      Text            =   "frmBOL.frx":0359
      Top             =   2280
      Width           =   3555
   End
   Begin MSDataGridLib.DataGrid grdLTL 
      Height          =   1635
      Left            =   420
      TabIndex        =   51
      TabStop         =   0   'False
      ToolTipText     =   "To Delete an Item highlight the row and press the Delete key."
      Top             =   5340
      Width           =   10335
      _ExtentX        =   18230
      _ExtentY        =   2884
      _Version        =   393216
      DefColWidth     =   67
      HeadLines       =   1
      RowHeight       =   15
      TabAction       =   2
      WrapCellPointer =   -1  'True
      AllowDelete     =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.Label lblDIMs 
      BackColor       =   &H00FFFFFF&
      Caption         =   "L x W x H in."
      ForeColor       =   &H000080FF&
      Height          =   255
      Left            =   3540
      TabIndex        =   62
      Top             =   4980
      Width           =   1215
   End
   Begin VB.Label Label14 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Item ID:"
      Height          =   255
      Left            =   600
      TabIndex        =   61
      Top             =   3540
      Width           =   1095
   End
   Begin VB.Label lbl6102 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "P.O. Box:"
      Height          =   255
      Left            =   5760
      TabIndex        =   60
      Top             =   1260
      Width           =   915
   End
   Begin VB.Label lblf1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Order ID:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   180
      TabIndex        =   59
      Top             =   540
      Width           =   1515
   End
   Begin VB.Label Label13 
      Alignment       =   2  'Center
      BackColor       =   &H00FFFFFF&
      Caption         =   "- OR -"
      ForeColor       =   &H000080FF&
      Height          =   255
      Left            =   5100
      TabIndex        =   58
      Top             =   4920
      Width           =   615
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "P.O. Number:"
      Height          =   255
      Index           =   12
      Left            =   6180
      TabIndex        =   57
      Top             =   4260
      Width           =   1035
   End
   Begin VB.Label lblWeight 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Weight:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   56
      Top             =   4620
      Width           =   1575
   End
   Begin VB.Label lblCommodity 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Description:"
      Height          =   255
      Index           =   2
      Left            =   6240
      TabIndex        =   55
      Top             =   3540
      Width           =   975
   End
   Begin VB.Label Label73 
      Alignment       =   2  'Center
      BackColor       =   &H00FFFFFF&
      Caption         =   "x"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   2760
      TabIndex        =   54
      Top             =   4950
      Width           =   255
   End
   Begin VB.Label Label24 
      Alignment       =   2  'Center
      BackColor       =   &H00FFFFFF&
      Caption         =   "x"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   2160
      TabIndex        =   53
      Top             =   4950
      Width           =   255
   End
   Begin VB.Label Label17 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Dimensions:"
      Height          =   255
      Index           =   0
      Left            =   720
      TabIndex        =   52
      Top             =   4980
      Width           =   975
   End
   Begin VB.Line Line1 
      BorderColor     =   &H000080FF&
      BorderWidth     =   2
      Index           =   22
      X1              =   5580
      X2              =   5580
      Y1              =   360
      Y2              =   2760
   End
   Begin VB.Label Label63 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Line Items Information"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   255
      Index           =   0
      Left            =   360
      TabIndex        =   50
      Top             =   3075
      Width           =   2055
   End
   Begin VB.Line Line1 
      BorderColor     =   &H000080FF&
      BorderWidth     =   2
      Index           =   13
      X1              =   360
      X2              =   10740
      Y1              =   3060
      Y2              =   3060
   End
   Begin VB.Label Label12 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Payor/Bill-To Information"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   255
      Left            =   5820
      TabIndex        =   49
      Top             =   150
      Width           =   2355
   End
   Begin VB.Line Line1 
      BorderColor     =   &H000080FF&
      BorderWidth     =   2
      Index           =   1
      X1              =   5820
      X2              =   10740
      Y1              =   135
      Y2              =   120
   End
   Begin VB.Label Label11 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Shipment Information"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   255
      Left            =   360
      TabIndex        =   48
      Top             =   135
      Width           =   2055
   End
   Begin VB.Line Line1 
      BorderColor     =   &H000080FF&
      BorderWidth     =   2
      Index           =   0
      X1              =   360
      X2              =   5340
      Y1              =   120
      Y2              =   120
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "(75 Chars Max) "
      ForeColor       =   &H000080FF&
      Height          =   255
      Index           =   9
      Left            =   600
      TabIndex        =   47
      Top             =   2580
      Width           =   1155
   End
   Begin VB.Label Label10 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Shipper #2:"
      Height          =   255
      Left            =   240
      TabIndex        =   46
      Top             =   1980
      Width           =   1455
   End
   Begin VB.Label Label6 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Shipper #1:"
      Height          =   255
      Left            =   240
      TabIndex        =   45
      Top             =   1620
      Width           =   1455
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "BOL #:"
      Height          =   255
      Left            =   6180
      TabIndex        =   44
      Top             =   4620
      Width           =   1035
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Shipment Terms:"
      Height          =   315
      Index           =   1
      Left            =   180
      TabIndex        =   43
      Top             =   1260
      Width           =   1515
   End
   Begin VB.Label Label9 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "ProNumber:"
      Height          =   255
      Left            =   240
      TabIndex        =   42
      Top             =   900
      Width           =   1455
   End
   Begin VB.Label Label8 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Shipment Volume:"
      Height          =   255
      Left            =   5880
      TabIndex        =   41
      Top             =   4980
      Width           =   1335
   End
   Begin VB.Label Label7 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "NMFC Item#:"
      Height          =   255
      Left            =   240
      TabIndex        =   40
      Top             =   4260
      Width           =   1455
   End
   Begin VB.Label Label5 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "NMFC Class:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   39
      Top             =   3900
      Width           =   1455
   End
   Begin VB.Label Label4 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "# of Pallets:"
      Height          =   255
      Left            =   4020
      TabIndex        =   38
      Top             =   4260
      Width           =   915
   End
   Begin VB.Label Label3 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "# of Pieces:"
      Height          =   255
      Left            =   4020
      TabIndex        =   37
      Top             =   3900
      Width           =   915
   End
   Begin VB.Label lblPayor 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Zip:"
      Height          =   255
      Index           =   4
      Left            =   9180
      TabIndex        =   36
      Top             =   1980
      Width           =   375
   End
   Begin VB.Label lblPayor 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "State:"
      Height          =   255
      Index           =   3
      Left            =   6060
      TabIndex        =   35
      Top             =   1980
      Width           =   615
   End
   Begin VB.Label lblPayor 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "City:"
      Height          =   255
      Index           =   1
      Left            =   6180
      TabIndex        =   34
      Top             =   1620
      Width           =   495
   End
   Begin VB.Label lblPayor 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Address 1:"
      Height          =   255
      Index           =   2
      Left            =   5640
      TabIndex        =   33
      Top             =   900
      Width           =   1035
   End
   Begin VB.Label lblPayor 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Company:"
      Height          =   255
      Index           =   0
      Left            =   5700
      TabIndex        =   32
      Top             =   540
      Width           =   975
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      Caption         =   "Special Instructions:"
      Height          =   315
      Index           =   0
      Left            =   180
      TabIndex        =   31
      Top             =   2340
      Width           =   1515
   End
End
Attribute VB_Name = "frmBOL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'General Section
Public WithEvents g_rsLTL As ADODB.Recordset
Attribute g_rsLTL.VB_VarHelpID = -1
'---------------------------------------------------------------------------------------
' Procedure : AddLTLToMDB()
' DateTime  : 01/11/2006
' Purpose   : Adds a record to the LTL database and returns the number of
'             records affected...usually '1'.
'---------------------------------------------------------------------------------------
'
Public Sub AddLTLToMDB()
    
    Dim strQuery As String
    
    On Error GoTo EH
    
    'Build and execute the SQL statement
    strQuery = "INSERT into LTLMulti VALUES (" & SingleQuotes(f1) & ","
    strQuery = strQuery & SingleQuotes(f6105) & ","
    strQuery = strQuery & SingleQuotes(f6106) & ","
    strQuery = strQuery & SingleQuotes(f1670) & ","
    '--------------------------------------------------
    '20070626-01 Added Trim statements to removes spaces before saving DIMs
    If IsNumeric(f57) Then
        strQuery = strQuery & SingleQuotes(Trim(f57)) & ","
    Else
        strQuery = strQuery & "'',"
    End If
    If IsNumeric(f58) Then
        strQuery = strQuery & SingleQuotes(Trim(f58)) & ","
    Else
        strQuery = strQuery & "'',"
    End If
    If IsNumeric(f59) Then
        strQuery = strQuery & SingleQuotes(Trim(f59)) & ","
    Else
        strQuery = strQuery & "'',"
    End If
    '--------------------------------------------------
    strQuery = strQuery & SingleQuotes(f2931) & ","
    strQuery = strQuery & SingleQuotes(f1271) & ","
    If f1331 = 1 Then
        strQuery = strQuery & "'Y',"
    Else
        strQuery = strQuery & "'N',"
    End If
    strQuery = strQuery & SingleQuotes(f79) & ","
    strQuery = strQuery & SingleQuotes(f3056) & ","
    strQuery = strQuery & SingleQuotes(f4683) & ","
    strQuery = strQuery & SingleQuotes(f6101) & ","
    strQuery = strQuery & SingleQuotes(g_strComputerName) & ")"
    
    g_connFSMSClient.Execute strQuery

    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:AddLTLToMDB"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : AssignFormGlobalVars()
' DateTime  : 1/10/2006
' Purpose   : Assign LTL Global Vars
'---------------------------------------------------------------------------------------
'
Public Sub AssignFormGlobalVars()
    
    g_str1222 = f1222               'ProNumber
    g_str6107 = Left(f6107, 1)      'Shipment Terms
    g_str6108 = f6108               'Shipper #1
    g_str6109 = f6109               'Shipper #2
    g_str3021 = f3021               'Spcl Instr
    g_str4647 = f4647               'Payor Company
    g_str4639 = f4639               'Payor Addr1
    g_str6102 = f6102               'Payor P.O. Box
    g_str4641 = f4641               'Payor City
    g_str4648 = f4648               'Payor Zip
    g_str4649 = Left(f4649, 2)      'Payor St
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : cboBoxName_Click()
' DateTime  : 1/10/2006
' Purpose   : Loads box DIMs for selected box name.
'---------------------------------------------------------------------------------------
'
Private Sub cboBoxName_Click()
    Dim rsBoxDIMs As New ADODB.Recordset
    Dim strQuery As String
    
    On Error GoTo EH
    
    strQuery = "SELECT * FROM Dimensions WHERE BoxName = " & SingleQuotes(cboBoxName)
    rsBoxDIMs.Open strQuery, g_connFSMSClient, adOpenStatic, adLockOptimistic
    
    If Not rsBoxDIMs.EOF Then
        f57 = rsBoxDIMs!g_str57
        f58 = rsBoxDIMs!g_str58
        f59 = rsBoxDIMs!g_str59
    End If
    
Release:

    If rsBoxDIMs.State = adStateOpen Then
        rsBoxDIMs.Close
    End If
    Set rsBoxDIMs = Nothing
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:cboBoxName_Click"
    Resume Release
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : ClearItemFields()
' DateTime  : 1/10/2006
' Purpose   : Clear multi-occurrence fields
'---------------------------------------------------------------------------------------
'
Private Sub ClearItemFields()
    f6105 = ""
    f6106 = ""
    f1670 = ""
    f57 = ""
    f58 = ""
    f59 = ""
    cboBoxName = ""
    f2931 = ""
    f1271 = ""
    f79 = ""
    f3056 = ""
    f4683 = ""
    f6101 = ""
    
End Sub

Private Sub cboItemID_Click()
    Call GetItemFields(cboItemID)
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cboItemID_KeyPress()
' DateTime  : 3/10/2006
' Purpose   : Searched Item ID combo as key pressed
'---------------------------------------------------------------------------------------
'
Private Sub cboItemID_KeyPress(KeyAscii As Integer)
    Call SearchCombo(cboItemID, KeyAscii)
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdAdd_Click()
' DateTime  : 1/10/2006
' Purpose   : Add button clicked, call subs to add record to MDB, update grid, clear item fields
'---------------------------------------------------------------------------------------
'
Private Sub cmdAdd_Click()
    
    On Error GoTo EH
    
    Call AddLTLToMDB
    Call UpdateLTLGrid(f1)
    Call ClearItemFields
    f6105.SetFocus
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:cmdAdd_Click"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : cmdClose_Click()
' DateTime  : 01/10/2006
' Purpose   : Close clicked, hide the form.
'---------------------------------------------------------------------------------------
'
Private Sub cmdClose_Click()
    
    Me.Hide
    If frmShip.Visible Then frmShip.SetFocus
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : cmdDelete_Click()
' DateTime  : 01/10/2006
' Purpose   : Verifes user wished to delete all pieces in a shipment and if yes, calls
'           : DeleteLTL and UpdateLTLGrid.
'---------------------------------------------------------------------------------------
'
Private Sub cmdDelete_Click()
    Dim intRet As Integer

    intRet = MsgBox("Are you sure you wish to delete all pieces in this shipment?", vbYesNo, "Confirm Delete All")
    If intRet = vbYes Then
        Call DeleteLTLMulti(f1)
        Call UpdateLTLGrid(f1)
    End If

End Sub
'---------------------------------------------------------------------------------------
' Procedure : cmdSave_Click()
' DateTime  : 01/10/2006
' Purpose   : Save/Exit clicked, assign global vars, hide form and set focus to Ship form
'---------------------------------------------------------------------------------------
'
Private Sub cmdSave_Click()
    
    On Error GoTo EH
    
    Call AssignFormGlobalVars
    Me.Hide
    If frmShip.Visible Then frmShip.SetFocus

    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:cmdSaveExit_Click"

End Sub
'---------------------------------------------------------------------------------------
' Module    : DeleteLTLMulti()
' DateTime  : 1/11/2006
' Author    : Chris Elwell
' Purpose   : Deletes records for an Order ID in the LTLMulti table.
'---------------------------------------------------------------------------------------
'
Public Sub DeleteLTLMulti(ByVal str1 As String)
    
    On Error GoTo EH
    
    Dim strQuery As String
    
    strQuery = "DELETE FROM LTLMulti WHERE f1 = " & SingleQuotes(str1)
    strQuery = strQuery + " AND Workstation = '" & g_strComputerName & "'"
    
    g_connFSMSClient.Execute strQuery
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:DeleteLTLMulti"

End Sub
'---------------------------------------------------------------------------------------
' Module    : EnableAddButton()
' DateTime  : 1/11/2006
' Author    : Chris Elwell
' Purpose   : Enable Add button if Order ID not blank
'---------------------------------------------------------------------------------------
'
Private Sub EnableAddButton()
    cmdAdd.Enabled = IIf(f1 <> "", True, False)
End Sub
'---------------------------------------------------------------------------------------
' Module    : f1_Change()
' DateTime  : 1/11/2006
' Author    : Chris Elwell
' Purpose   : Call routine to enable button
'---------------------------------------------------------------------------------------
'
Private Sub f1_Change()
    Call EnableAddButton
End Sub
'---------------------------------------------------------------------------------------
' Module    : f1_LostFocus()
' DateTime  : 1/11/2006
' Author    : Chris Elwell
' Purpose   : Update grid
'---------------------------------------------------------------------------------------
'
Private Sub f1_LostFocus()
    Call UpdateLTLGrid(f1)
End Sub
'---------------------------------------------------------------------------------------
' Module    : f4649_Change()
' DateTime  : 1/11/2006
' Author    : Chris Elwell
' Purpose   : Call routine to show entire State code when code entered
'---------------------------------------------------------------------------------------
'
Private Sub f4649_Change()
    On Error GoTo EH

    If Len(f4649) >= 2 Then
        Call SetComboSelection(f4649, f4649)
    End If
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:f4649_Change"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : f57_Change(), f58_Change(), f59_Change()
' DateTime  : 5/10/2006
' Purpose   : Dimensions fields are a max length of 3. Set default text to show dimension
'---------------------------------------------------------------------------------------
'
Private Sub f57_Change()
    On Error GoTo EH
    
    If f57.Text <> Trim(f57.Text) Then f57.Text = Trim(f57.Text)
    If f57 = "" Then f57 = " H "
    Call CheckLength(f57, 3)
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBol:f57_Change"

End Sub

Private Sub f58_Change()
    On Error GoTo EH
    
    If f58.Text <> Trim(f58.Text) Then f58.Text = Trim(f58.Text)
    If f58 = "" Then f58 = " W "
    Call CheckLength(f58, 3)
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBol:f58_Change"

End Sub

Private Sub f59_Change()
    On Error GoTo EH
    
    If f59.Text <> Trim(f59.Text) Then f59.Text = Trim(f59.Text)
    If f59 = "" Then f59 = " L "
    Call CheckLength(f59, 3)
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBol:f59_Change"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : f6105_KeyPress()
' DateTime  : 2/8/2006
' Purpose   : Calls routine to search combo for first matching value
'---------------------------------------------------------------------------------------
'
Private Sub f6105_KeyPress(KeyAscii As Integer)

    Call SearchCombo(f6105, KeyAscii)
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f6107_Change()
' DateTime  : 2/8/2006
' Purpose   : Calls routine to set complete text of selection
'---------------------------------------------------------------------------------------
'
Private Sub f6107_Change()
    If Len(f6107) >= 1 Then
        Call SetComboSelection(f6107, f6107)
    End If

End Sub

'---------------------------------------------------------------------------------------
' Module    : Form_Activate()
' DateTime  : 1/11/2006
' Author    : Chris Elwell
' Purpose   : Set values when form gets focus
'---------------------------------------------------------------------------------------
'
Private Sub Form_Activate()
    On Error GoTo EH

'    frmShip.f1.Enabled = False
'    frmShip.cboCustID.Enabled = False

    With frmShip
        f1 = IIf(.f1.Visible, .f1, .cboCustID)
        lblf1.Caption = IIf(.f1.Visible, "Order ID", "Customer ID")
    End With
    
    If Left(frmShip.f23, 1) = "3" Then
        Call EnablePayorFields(True)
    Else
        Call EnablePayorFields(False)
    End If
    Call EnableAddButton
    Call UpdateLTLGrid(f1)
    
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:Form_Activate"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_KeyDown()
' DateTime  : 01/10/2006
' Purpose   : Enter key pressed sends a TAB to move to next field
'---------------------------------------------------------------------------------------
'
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If Not TypeOf Me.ActiveControl Is CommandButton Then
        If Shift = 0 And KeyCode = 13 Then
            SendKeys "{TAB}"
        End If
    End If
End Sub
'---------------------------------------------------------------------------------------
' Module    : Form_Load()
' DateTime  : 1/11/2006
' Author    : Chris Elwell
' Purpose   : Load values on intial form load
'---------------------------------------------------------------------------------------
'
Private Sub Form_Load()
    On Error GoTo EH

    'Instantiate global recordset
    Set g_rsLTL = New ADODB.Recordset
    
    'Load Payor State combo
    If g_str117 = "US" Then
        Call LoadStates(f4649)
    ElseIf g_str117 = "CA" Then
        Call LoadProvinces(f4649)
    ElseIf g_str117 = "MX" Then
        Call LoadMXStates(f4649)
    Else
        f4649.Clear
    End If
    
    'Load NMFC combo
    f6105.AddItem "50.0"
    f6105.AddItem "55.0"
    f6105.AddItem "60.0"
    f6105.AddItem "65.0"
    f6105.AddItem "70.0"
    f6105.AddItem "77.5"
    f6105.AddItem "85.0"
    f6105.AddItem "92.5"
    f6105.AddItem "100.0"
    f6105.AddItem "110.0"
    f6105.AddItem "125.0"
    f6105.AddItem "150.0"
    f6105.AddItem "175.0"
    f6105.AddItem "200.0"
    f6105.AddItem "250.0"
    f6105.AddItem "300.0"
    
    'Load DIMs combo
    Call LoadBoxDIMsCombos(cboBoxName)
   
    'Load Items ID combo
    Call LoadItemsIDCombo
   
    f57 = " H "
    f58 = " W "
    f59 = " L "
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:Form_Load"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_Unload()
' DateTime  : 1/16/2006
' Purpose   : Kills objects
'---------------------------------------------------------------------------------------
'
Private Sub Form_Unload(Cancel As Integer)
    Set grdLTL.DataSource = Nothing
    If g_rsLTL.State = adStateOpen Then g_rsLTL.Close
    Set g_rsLTL = Nothing
End Sub
'---------------------------------------------------------------------------------------
' Procedure : EnablePayorFields()
' DateTime  : 1/16/2006
' Purpose   : Enables/disables payor fields
'---------------------------------------------------------------------------------------
'
Private Sub EnablePayorFields(ByVal blnEnable As Boolean)
    On Error GoTo EH

    Dim i As Integer
    
    f4647.Enabled = blnEnable
    f4639.Enabled = blnEnable
    f4641.Enabled = blnEnable
    f4648.Enabled = blnEnable
    f4649.Enabled = blnEnable
    f6102.Enabled = blnEnable
    lbl6102.Enabled = blnEnable
    For i = 0 To lblPayor.UBound
        lblPayor(i).Enabled = blnEnable
        lblPayor(i).FontBold = blnEnable
    Next

    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:EnablePayorFields"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : grdLTL_AfterColUpdate()
' DateTime  : 7/15/2004
' Modified  : 8/11/2004
' Change    : Added a check for Null before setting the bookmark. This allows records
'             to be added. Also added error handling.
' Purpose   : This commits the changes immediately after a column has been updated.
'             This keeps users from getting "Operation not allowed in this context" error.
'---------------------------------------------------------------------------------------
'
Private Sub grdLTL_AfterColUpdate(ByVal ColIndex As Integer)
    
    On Error GoTo EH

    If grdLTL.Bookmark >= 0 Then
        grdLTL.Bookmark = grdLTL.Bookmark
    End If
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:grdLTL_AfterColUpdate"
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : grdLTL_AfterDelete()
' DateTime  : 3/16/2004
' Purpose   : Update recordcount after a record is deleted.
'---------------------------------------------------------------------------------------
'
Private Sub grdLTL_AfterDelete()
    
    On Error GoTo EH
    
    Call UpdateLTLGrid(f1)
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:grdLTL_AfterDelete"
'    Resume Release
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : grdLTL_BeforeDelete()
' DateTime  : 3/19/2004
' Purpose   : Verify user wishes to delete a record in the MPS grid.
'---------------------------------------------------------------------------------------
'
Private Sub grdLTL_BeforeDelete(Cancel As Integer)
    Dim intResult As Integer
    
    intResult = MsgBox("Are you sure that you want to delete selected record?", vbYesNo, "Delete Confirmation")
   
    If intResult = vbNo Then
        Cancel = True
    End If

End Sub
'---------------------------------------------------------------------------------------
' Procedure : UpdateMPSGrid()
' DateTime  : 3/19/2004
' Purpose   : Update the datagrid for given OrderID. Also assign column captions.
' Call from : Form_Activate, cmdAddMPS_Click, frmShip.f1_LostFocus,
'             cmdDelete_Click,
'---------------------------------------------------------------------------------------
'
Public Sub UpdateLTLGrid(ByVal f1 As String)
    
    On Error GoTo EH
    
    Dim strQuery As String
    
    'Build and open the recordset
    strQuery = "SELECT f1,f6105,f6106,f1670,f59,f58,f57,f2931,f1271,f1331,f3056,"
    strQuery = strQuery + "f4683,f6101 FROM LTLMulti WHERE f1 = '" & f1 & "'"
    strQuery = strQuery + " AND Workstation = '" & g_strComputerName & "'"
    
    If g_rsLTL.State = adStateOpen Then g_rsLTL.Close
    
    g_rsLTL.Open strQuery, g_connFSMSClient, adOpenStatic, adLockOptimistic

    Set grdLTL.DataSource = g_rsLTL
    With grdLTL
        .ClearFields
        .ReBind
        .Columns(0).Caption = "OrderID"
        .Columns(0).Width = 1200
        .Columns(1).Caption = "Class"
        .Columns(1).Width = 800
        .Columns(2).Caption = "Item #"
        .Columns(2).Width = 800
        .Columns(3).Caption = "Weight"
        .Columns(3).Width = 800
        .Columns(4).Caption = "L"
        .Columns(4).Width = 500
        .Columns(5).Caption = "W"
        .Columns(5).Width = 500
        .Columns(6).Caption = "H"
        .Columns(6).Width = 500
        .Columns(7).Caption = "# Pieces"
        .Columns(7).Width = 1000
        .Columns(8).Caption = "# Pallets"
        .Columns(8).Width = 1000
        .Columns(9).Caption = "Haz-Mat"
        .Columns(9).Width = 500
        .Columns(10).Caption = "PO #"
        .Columns(10).Width = 1000
        .Columns(11).Caption = "BOL #"
        .Columns(11).Width = 1200
        .Columns(12).Caption = "Volume"
        .Columns(12).Width = 1000
        .Caption = "Total Items: " & Str(g_rsLTL.RecordCount)
    End With
    
    Exit Sub
    
EH:
    'Added to ignore "Operation not allowed in this context" error
    If Err.number <> 3219 Then
        MsgBox Err.Description, vbCritical, "frmBOL:UpdateLTLGrid"
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : LoadItemsIDCombo()
' DateTime  : 3/10/2006
' Purpose   : Loads the Item ID combo
'---------------------------------------------------------------------------------------
'
Public Sub LoadItemsIDCombo()
    
    On Error GoTo EH
    
    Dim strQuery As String
    Dim rsItems As New ADODB.Recordset
    
    strQuery = "SELECT ItemID From LTLItems"
    
    rsItems.Open strQuery, g_connFSMSClient, adOpenDynamic, adLockBatchOptimistic
    
    Do Until rsItems.EOF
        cboItemID.AddItem rsItems!ItemID
        
        rsItems.MoveNext
    Loop
    
Release:
    If rsItems.State = adStateOpen Then rsItems.Close
    Set rsItems = Nothing
    
    Exit Sub

EH:
    MsgBox Err.Description, vbCritical, "frmBOL:LoadItemsIDCombo"
    Resume Release
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : GetItemFields()
' DateTime  : 3/10/2006
' Purpose   : Loads the Item fields stored in the LTLItems table for a given ItemID.
'-----------------------------------------------------------------------------------    ----
'
Private Sub GetItemFields(ByVal strItemID As String)

    On Error GoTo EH
    
    Dim strQuery As String
    Dim rsItem As New ADODB.Recordset
    
    strQuery = "SELECT * FROM LTLItems WHERE ItemID = " & SingleQuotes(strItemID)
    
    rsItem.Open strQuery, g_connFSMSClient, adOpenDynamic, adLockBatchOptimistic
    
    '20070808-05 Added f1670, f59, f58, f57, f2931, f1271, & f6101 to LTLItems table
    If Not rsItem.EOF Then
        f6105 = rsItem!f6105 & ""
        f6106 = rsItem!f6106 & ""
        f79 = rsItem!f79 & ""
        f1331 = rsItem!f1331 & ""
        f1670 = rsItem!f1670 & ""
        f59 = rsItem!f59 & ""
        f58 = rsItem!f58 & ""
        f57 = rsItem!f57 & ""
        f2931 = rsItem!f2931 & ""
        f1271 = rsItem!f1271 & ""
        f6101 = rsItem!f6101 & ""
    End If
    
Release:
    If rsItem.State = adStateOpen Then rsItem.Close
    Set rsItem = Nothing
    
    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, "frmBOL:GetItemFields"
    Resume Release
    
End Sub
'---------------------------------------------------------------------------------------
' Module    : GotFocus - textboxes
' DateTime  : 8/29/2005
' Author    : Chris Elwell
' Purpose   : The subroutines below call a routine to select all text in the text box
'             passed to the sub.
'---------------------------------------------------------------------------------------
'
'Order ID
Private Sub f1_GotFocus()
    Call SelectAllText(f1)
End Sub
'ProNumber
Private Sub f1222_GotFocus()
    Call SelectAllText(f1222)
End Sub
'Shipper #1
Private Sub f6108_GotFocus()
    Call SelectAllText(f6108)
End Sub
'Shipper #2
Private Sub f6109_GotFocus()
    Call SelectAllText(f6109)
End Sub
'Special Instructions
Private Sub f3021_GotFocus()
    Call SelectAllText(f3021)
End Sub
'Company
Private Sub f4647_GotFocus()
    Call SelectAllText(f4647)
End Sub
'Addr 1
Private Sub f4639_GotFocus()
    Call SelectAllText(f4639)
End Sub
'City
Private Sub f4641_GotFocus()
    Call SelectAllText(f4641)
End Sub
'Zip
Private Sub f4648_GotFocus()
    Call SelectAllText(f4648)
End Sub
'NMFC Item#
Private Sub f6106_GotFocus()
    Call SelectAllText(f6106)
End Sub
'Weight
Private Sub f1670_GotFocus()
    Call SelectAllText(f1670)
End Sub
'Dim
Private Sub f57_GotFocus()
    Call SelectAllText(f57)
End Sub
'Dim
Private Sub f58_GotFocus()
    Call SelectAllText(f58)
End Sub
'Dim
Private Sub f59_GotFocus()
    Call SelectAllText(f59)
End Sub
'# pieces
Private Sub f2931_GotFocus()
    Call SelectAllText(f2931)
End Sub
'# pallets
Private Sub f1271_GotFocus()
    Call SelectAllText(f1271)
End Sub
'Desc
Private Sub f79_GotFocus()
    Call SelectAllText(f79)
End Sub
'PO#
Private Sub f3056_GotFocus()
    Call SelectAllText(f3056)
End Sub
'BOL#
Private Sub f4683_GotFocus()
    Call SelectAllText(f4683)
End Sub
'Shipment volume
Private Sub f6101_GotFocus()
    Call SelectAllText(f6101)
End Sub
'---------------------------------------------------------------------------------------
'End of GotFocus event subs
'---------------------------------------------------------------------------------------


